/*
 * Copyright (c) 2022, tyustli
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2022-03-08     tyustli      first implementation
 */

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
    int num = 0;
    int *ptr = NULL;
    int max = 0;

    printf("input data num:\r\n");
    scanf("%d", &num);

    ptr = (int *)malloc(num * sizeof(int));
    if(ptr == NULL)
    {
        printf("no mem\r\n");
        goto __error;
    }

    printf("input %d data\r\n", num);
    for (int i = 0; i < num; i++)
    {
        scanf("%d", ptr + i);
        if (*(ptr + i) > max)
        {
            max = *(ptr + i);
        }
    }

    free(ptr);
    printf("max data is %d\r\n", max);

__error:
    return 0;
}

/********************** end of file **************************/
